<?php
/**
 * Pert Library
 * Test
 * User Class
 *
 * @author	Emre Hasegeli <hasegeli@gmail.com>
 * @license	GNU General Public License v3
 */

namespace Pert;

require '../Client.php';

require '../Language.php';

require '../User.php';

session_start();

echo '
<form action="" method="post" >';

if((!User::Get()) AND (isset($_POST['Login'])) AND ($_POST['Login'] == 'Login'))
{
	User::Login($_POST['Email'],
			$_POST['Password']);
	
	if(!User::Get())
		echo '
	<h3 >
		Login failed.
	</h3>';
}

if((User::Get()) AND (isset($_POST['Logout'])) AND ($_POST['Logout'] == 'Logout'))
	User::Get()->Logout();

//unset($_SESSION['Password']);
var_dump($_SESSION);

if(!User::Get())
	echo '
	<p >
		<input type="text" name="Email" maxlength="60" />
	</p>
	<p >
		<input type="password" name="Password" maxlength="20" />
	</p>
	<p >
		<input type="submit" name="Login" value="Login" />
	</p>';
else
	echo '
	<p >
		' . User::Get() . '
	</p>
	<p >
		' . User::Get()->SelectLanguage() . '
	</p>
	<p >
		<input type="submit" name="Logout" value="Logout" />
	</p>';

echo '
</form>';
